////
//
/// \file ./include/inc/parser/statement_node.hpp
//
//  Copyright 2007, 2008 Chandler Carruth
//
//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
//  use this file except in compliance with the License.  You may obtain a copy
//  of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
//  License for the specific language governing permissions and limitations
//  under the License.
//
////

#ifndef inc_parser_statement_node_header
#define inc_parser_statement_node_header

#include <string>

#include <boost/scoped_ptr.hpp>

#include <inc/parser/parse_tree_node.hpp>
#include <inc/parser/ws_parser.hpp>

namespace inc {
namespace parser {

class ProcedureCallNode;
class MutationNode;

/// \brief  Statement Node
/// \author Chandler Carruth
/// \date   2008.06.03
///
/// This parses out a single statement for INC. Each statement potentially has
/// a side-effect, and are arranged in a strict vertical ordering: control
/// flows down.

class StatementNode : public ParseTreeNode
{
public:
  StatementNode();

  virtual bool parse( const iterator& first,
                      const iterator& last,
                      iterator& last_parsed );

  virtual bool is_break() const { return break_statement; }
  virtual bool is_finish() const { return finish_statement; }

  virtual ProcedureCallNode* get_procedure_call() const;
  virtual bool is_procedure_call() const { return get_procedure_call() != NULL; }

  virtual MutationNode* get_mutation() const;
  virtual bool is_mutation() const { return get_mutation() != NULL; }

private:
  bool break_statement;
  bool finish_statement;

  boost::scoped_ptr<WSParser> ws;
  boost::scoped_ptr<ParseTreeNode> node;
};

} //  end parser namespace
} //  end inc namespace
#endif  //  inc_parser_statement_node_header
